[LIBXC] Do not gzclose() after close() on a gzdopen()'ed fd.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Aug 2006 08:57:24 +0000 (09:57 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Aug 2006 08:57:24 +0000 (09:57 +0100)
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
tools/libxc/xc_linux_build.c

index 4a611fdd4400297da5ee280b44579a2ee08ca32d..9e7d39e34afb9ddcdb408277597a60fcdd3c35ed 100644 (file)
@@ -1373,10 +1373,10 @@ int xc_linux_build(int xc_handle,
 
  error_out:
     free(image);
-    if ( fd >= 0 )
-        close(fd);
-    if ( initrd_info.u.file_handle )
+    if ( initrd_info.type == INITRD_file && initrd_info.u.file_handle )
         gzclose(initrd_info.u.file_handle);
+    else if ( fd >= 0 )
+        close(fd);
 
     return sts;
 }